/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * WidokWczytajTerminal.java
 *
 * Created on 2011-03-26, 21:51:03
 */

package App.widoki;

import App.kontrolery.KontrolerWczytajTerminal;
import App.modele.ModelWczytajTerminal;

/**
 *
 * @author Krzysiek
 */
public class WidokWczytajTerminal extends javax.swing.JFrame {

    //**************************************************************************
    KontrolerWczytajTerminal kontroler = null;
    ModelWczytajTerminal model = null;
    //**************************************************************************
    public WidokWczytajTerminal(KontrolerWczytajTerminal kontroler, ModelWczytajTerminal model)
    {
        this.kontroler = kontroler;
        this.model = model;
        initComponents();

        this.setBounds(100, 100, this.getWidth(), this.getHeight());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jTextFieldSciezka = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Wczytywanie terminalu z pliku");

        jButton1.setText("Wybierz plik");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jTextFieldSciezka.setEditable(false);
        jTextFieldSciezka.setText("Nie wybrano żadnego pliku");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTextFieldSciezka, javax.swing.GroupLayout.DEFAULT_SIZE, 285, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldSciezka, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addContainerGap(139, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton1ActionPerformed
    {//GEN-HEADEREND:event_jButton1ActionPerformed
        kontroler.wybierzPlik();
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                //new WidokWczytajTerminal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JTextField jTextFieldSciezka;
    // End of variables declaration//GEN-END:variables

    public void zapiszSciezke()
    {
       this.jTextFieldSciezka.setText(model.getSciezkaDoPliku());
    }

}
